External HTML
Use this component to add correct typographic styling to textual HTML elements. Translation keys containing HTML elements are the primary use case.
#Examples
In some cases, such as when using translation keys, it can be technically difficult or impossible to use our typography components (e.g. headings, paragraphs, or links). Instead, regular HTML elements are used, such as <h1>
, <Paragraph>
, or <a>
. By wrapping these HTML elements in the external HTML element, they will automatically receive the same styling as that our our typography components.
#Default
Here you can see an example of how the external HTML component applies the same styling to a <Paragraph>
with an <a>
inside it, as that of our paragraph and link components.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet ullamcorper nunc ullamcorper fermentum. Curabitur accumsan nunc vitae pharetra dictum. Proin eu ante vel sem lobortis varius at id enim. Orci varius natoque penatibus et magnis dis parturient montes, nascetur dolor mus.
<ExternalHtml>
{`
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet ullamcorper nunc ullamcorper fermentum.
Curabitur accumsan nunc vitae pharetra dictum. Proin eu ante vel sem lobortis varius at id enim.
Orci varius natoque penatibus et magnis dis parturient montes, <a href="#default">nascetur dolor mus</a>.
</p>
`}
</ExternalHtml>
#Properties
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet ullamcorper nunc ullamcorper fermentum. Curabitur accumsan nunc vitae pharetra dictum. Proin eu ante vel sem lobortis varius at id enim. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Property | Description | Defined | Value |
---|---|---|---|
childrenRequired | string HTML string that is rendered with the styling of fancy typography components | ||
data-observe-keyOptional | string Unique string, used by external script e.g. for event tracking | ||
data-componentOptional | string Name of the component. Should only be set by components since it needs to stable. Used to track component usage | ||
classNameOptional | string Custom className that's applied to the outermost element (only intended for special cases) | ||
styleOptional | object Style object to apply custom inline styles (only intended for special cases) |
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications
#Writing
#Notable Changes
#Version 0.0.x
This component no longer has a textContainer
property. Instead, the text container component should be used to add vertical spacing between block-level HTML elements.